import request from '@/utils/request'
/** *
 * 获取组织架构数据
 * **/
export function reqGetDepartments() {
    return request({
      url: '/company/department'
    })
}
  /**
 * 根据id删除部门
 * **/
export function reqDelDepartments(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}
/**
 * 删除部门接口 @param{*} id 部门id
 **/
export function delDepartmentsApi(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'

  })
}

/**
 * 新增部门接口
 * @param {string} code 部门编码
 * @param {string} introduce 部门介绍
 * @param {string} manager 部门负责人
 * @param {string} name 部门名字
* @param {string} pid 部门父级ID
 **/
export function addDepartmentsApi(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

/**
 * 获取部门详情
 * @param {*} id 部id
 * @return 返回promise 对象
 **/
export function getDepartmentsApi(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'get'

  })
}
/**
 * 更新部门详情
 * @param {*} id 部id
 * @return 返回promise 对象
 **/
export function updataDepartmentsApi(from) {
  return request({
    url: `/company/department/${from.id}`,
    method: 'put',
    data: from
  })
}

